<template>
	<view class="">
		<view class="">
			<view class="bigbox">
				<view class="housename">
					{{arr.house_id.name || ''}}
				</view>
				<view class="ifobxo">
					<text class="room">{{arr.house_id.room || ''}}室</text>
					<text class="hall">{{arr.house_id.hall || ''}}厅</text>
					<text class="area">{{arr.house_id.building_area || ''}}㎡</text>
					<text class="orientation">{{arr.house_id.orientation || ''}}</text>
					<text class="plotname">{{arr.community_id.name || ''}}</text>
				</view>
				<view class="pricebox" v-if="type==1">
					<text class="pricename">实际价格:</text>
					<text class="price">{{arr.resources_id.price || ''}}万</text>
				</view>
				<view class="pricebox" v-if="type==2">
					<text class="pricename">实际价格:</text>
					<text class="price">{{arr.resources_id.price || ''}}元/月</text>
				</view>
				<view class="pricebox">
					<text class="pricename">成交价:</text>
					<text class="price">{{arr.money || ''}}元</text>
				</view>
				<view class="pricebox">
					<text class="pricename">佣金:</text>
					<text class="price">{{arr.commissions || ''}}元</text>
				</view>
				<view class="pricebox">
					<text class="pricename">备注:</text>
					<text class="remarks">{{arr.remarks || ''}}</text>
				</view>
				<view class="clientbox">
					<text class="clientinfo">
						客户信息:
					</text>
					<text class="contant">{{arr.guard_users_id.nickname || arr.guard_users_id.name}}</text>
					<text class="contant_telephone">{{arr.guard_users_id.phone || ''}}</text>
				</view>
				<view class="policebox" v-if="arr.security_id.name">
					<image src="https://fangguaner.wm76.mtnet.ren/static/applet/jincha.png" mode="" class="policeimg">
					</image>
					<text class="policename">{{arr.security_id.name || ''}}</text>
				</view>
				<view class="hr"></view>

				<view class="photobox">
					<view v-for="(item,index) in arr.imgs" :key="index" class="photo">
						<image :src="item" @click="getImgIndex(index,item)"></image>
					</view>
				</view>

				<view class="lastbox">
					<view class="brokerbox">
						<text>提交人:</text>
						<text class="brokername">{{arr.agent_id.name}}</text>
					</view>
					<view class="judgebox" v-if="genre==1">
						<text class="nopass" @click="nopass">不通过</text>
						<text class="pass" @click="pass">通过审核</text>
					</view>
					<view class="judgebox" v-if="genre==2">
						<text class="pass" v-if="genre==2" @click="fail()">
							修改审核
						</text>
					</view>
				</view>
			</view>
			<view class="hrss"></view>
		</view>


		<u-popup v-model="show" mode="center">
			<view class="tangchubox">
				<textarea :value="remark" placeholder="请输入不通过原因" class="reason" @input="shuru" />
				<view class="submits" @click="submit">
					提交
				</view>
			</view>
		</u-popup>

	</view>
</template>

<script>
	import {
		particularsRecordList,
		transactionrecord
	} from "../../api/api/index.js"
	export default {
		data() {
			return {
				isOk: false,
				arr: {},
				id: "",
				photos: [],
				show: false,
				remark: "",
				genre: 0,
				type:1
			}
		},
		methods: {
			getlist() {
				uni.showLoading({})
				let data = {
					id: this.id
				}
				particularsRecordList(data).then(res => {
					uni.hideLoading()
					this.arr = res.data
					this.photos = res.data.imgs
					this.type=res.data.type
				})
			},
			getImgIndex(index) {
				let imgs = this.photos
				uni.previewImage({
					urls: imgs,
					current: index
				})
			},
			// 审核通过
			pass() {
				let data = {
					id: this.id,
					type: 1
				}
				transactionrecord(data).then(res => {
					uni.showToast({
						title: res.message,
						icon: "none",
						duration: 1500
					})
					setTimeout(function() {
						uni.navigateBack({})
					}, 1500)
				})
			},
			// 审核不通过
			nopass() {
				this.show = true
			},
			shuru(e) {
				this.remark = e.detail.value
			},
			fail() {
				let types=""
				if(this.type=="租房"){
					types=2
				}else{
					types=1
				}
				this.jumpLink({
					link: "/pages/voucher/index",
					query: {
						guard_house_id: this.arr.house_id.id,
						follow_up_id: this.arr.follow_up_id,
						type: "fail",
						jiaoyi_id: this.arr.id,
						types:types
					}
				})
			},
			submit() {
				let data = {
					id: this.id,
					type: 2,
					audit_feedback: this.remark
				}
				transactionrecord(data).then(res => {
					uni.showToast({
						title: res.message,
						icon: "none",
						duration: 1500
					})
					setTimeout(function() {
						uni.navigateBack({

						})
					}, 1500)
				})
			}
		},
		onShow() {
			this.getlist()
		},
		onLoad(e) {
			this.id = e.id
			this.genre = e.genre
		},
		onPullDownRefresh() {
			setTimeout(function() {
				uni.stopPullDownRefresh();
			}, 1000);
		}
	}
</script>

<style scoped lang="less">
	.remarks{
		font-family: MicrosoftYaHei;
		font-size: 24rpx;
		color: #878787;
		margin-left: 10rpx;
	}
	.bigbox {
		padding: 57rpx 34rpx 35rpx 38rpx;
		box-sizing: border-box;

		.housename {
			font-family: MicrosoftYaHei-Bold;
			font-size: 28rpx;
			color: #282828;
			font-weight: 700;
			margin-bottom: 20rpx;

		}

		.ifobxo {
			font-family: MicrosoftYaHei;
			font-size: 22rpx;
			color: #878787;
			margin-bottom: 38rpx;

			text {
				margin-right: 10rpx;
			}
		}


		.pricebox {
			margin-bottom: 38rpx;

			.pricename {
				font-family: MicrosoftYaHei;
				font-size: 22rpx;
				color: #000000;
			}

			.price {
				font-family: PingFang-SC-Heavy;
				font-size: 23rpx;
				color: #e13c35;
				font-weight: 700;
				margin-left: 10rpx;
			}
		}

		.clientbox {
			.clientinfo {
				font-family: MicrosoftYaHei;
				font-size: 22rpx;
				color: #000000;
			}

			.contant {
				font-family: MicrosoftYaHei;
				font-size: 24rpx;
				color: #878787;
				margin-left: 10rpx;
			}

			.contant_telephone {
				font-family: MicrosoftYaHei;
				font-size: 24rpx;
				color: #878787;
				margin-left: 20rpx;
			}
		}

		.policebox {
			margin-left: 469rpx;
			display: flex;
			margin-top: 20rpx;
			align-items: center;

			image {
				width: 25rpx;
				height: 39rpx;
			}

			.policehouse {
				font-family: MicrosoftYaHei;
				font-size: 24rpx;
				color: #666666;
				margin-left: 15rpx;
			}

			.policename {
				font-family: MicrosoftYaHei;
				font-size: 24rpx;
				color: #666666;
				margin-left: 15rpx;
			}
		}

		.hr {
			width: 100%;
			height: 1rpx;
			background-color: #ededed;
			margin-top: 17rpx;
		}

		.lastbox {
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding: 20rpx;
			box-sizing: border-box;

			.brokerbox {
				font-family: MicrosoftYaHei;
				font-size: 24rpx;
				color: #000000;

				.brokername {
					color: #666666;
					margin-left: 10rpx;
				}
			}

			.judgebox {
				.nopass {
					display: inline-block;
					width: 160rpx;
					height: 61rpx;
					background-color: #ffffff;
					border-radius: 31rpx;
					border: solid 3rpx #5f5f5f;
					color: #393939;
					font-family: MicrosoftYaHei;
					font-size: 26rpx;
					text-align: center;
					line-height: 61rpx;
					margin-right: 30rpx;
				}

				.pass {
					display: inline-block;
					width: 160rpx;
					height: 61rpx;
					background-color: #ffffff;
					border-radius: 31rpx;
					border: solid 3rpx #df4744;
					color: #d72f2c;
					font-family: MicrosoftYaHei;
					font-size: 26rpx;
					text-align: center;
					line-height: 61rpx;
				}
			}
		}

	}

	.hrss {
		width: 750rpx;
		height: 15rpx;
		background-color: #ededed;
		margin-top: -rpx;
	}

	.photobox {
		margin-top: 40rpx;
		display: flex;
		flex-wrap: wrap;
		align-items: center;

		.photo {
			margin-right: 10rpx;

			image {
				width: 150rpx;
				height: 150rpx;
				border-radius: 10rpx;
			}
		}
	}

	.tangchubox {
		width: 658rpx;

		.reason {
			font-size: 30rpx;
			padding: 20rpx;
			box-sizing: border-box;
		}

		.submits {
			width: 658rpx;
			height: 100rpx;
			text-align: center;
			line-height: 100rpx;
			background-color: #ef0000;
			color: #FFFFFF;
		}
	}
</style>
